package ai.genetic;

import java.util.Comparator;

public interface Environment<O extends Object, I extends Individual<O>> extends Comparator<Individual<O>>
{
    /**
     * computes fitness for individual, should store value so that
     * future calls to getFitness can retrieve it without computation
     * in case it is expensive.
     *
     * @param individual person to evaluate
     * @return newly computed fitness
     */
    public double evaluateFitness(I individual);

    /**
     * returns most recently stored fitness for this individual,
     * as stored by evaluateFitness. Used for optimization
     *
     * @param individual person to evaluate
     * @return previously computed fitness
     */
    public double getFitness(I individual);


    /**
     * The threshold for the fitness
     *
     * @return
     */
    public double getFitnessThreshold();
}
